package com.zhangwei.expands.recycler;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;

import com.zhangwei.expands.R;
import com.zhangwei.expands.recycler.bean.DataItem;

import java.util.ArrayList;

import butterknife.Bind;
import butterknife.ButterKnife;


public class HotFragment extends Fragment implements AdapterView.OnItemClickListener {
    @Bind(R.id.hot_recycler)
    RecyclerView hotRecycler;
//    @Bind(R.id.loading_pregress)
//    BusyIndicator loadingPregress;
    private HotRecyclerAdapter hotAdapter;

    private ArrayList<DataItem> itemList = new ArrayList<>();


    public static HotFragment newInstance() {
        HotFragment fragment = new HotFragment();
        return fragment;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_hot, container, false);
        ButterKnife.bind(this, view);
        initView();
        initData();
        return view;
    }

    private void initView() {
        hotAdapter = new HotRecyclerAdapter(getActivity(), itemList);
        hotAdapter.setOnItemClickListener(this);
        hotRecycler.setAdapter(hotAdapter);
    }

    private void initData() {

    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

    }
}
